#ifndef _IocpThread_H_
#define _IocpThread_H_

#include "Thread.h"
#include "Iocp.h"

class IocpThread : public Thread, public Iocp
{
public:
	IocpThread();
	virtual ~IocpThread();

	void Post(void *pvArg);

	void SetIocpWaitTime(ulong time);

	virtual void IocpWork(void *pvArg) = 0;
	virtual void Error(void *pvArg, int lasterror) = 0;
	
	virtual void Stop();
protected:
	virtual void Worker();

private:
	bool m_bReturn;
	ulong m_ulTransferred;
	ulong *m_pulCompletionkey;
	OVERLAPPED *m_pkOverlapped;
	ulong m_ulWaitTime;
};


#endif // _IocpThread_H_